#include"Student.h"
#include<string>
#include<cstring>
#include<iostream>

Student::Student(int id, const char* name, int score[3])
{
    m_id=id;
    m_name=name;
    for(int i=0; i<3; i++)
    {
        m_score[i]=score[i];
    }
}

double Student::average()
{
    return 1.00*(m_score[0]+m_score[1]+m_score[2])/3;
}

void Student::display()
{
    std::cout<<"姓名:"<<m_name<<"\n"<<"学号:"<<m_id<<"\n"<<"三门课程分数:";
    for(int i=0;i<3;i++)
    std::cout<<m_score[i]<<"   ";
    std::cout<<"平均分为:"<<average()<<std::endl;
}

